﻿using com.guojin.core.io.message;
using com.guojin.mj.net.message.login;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class WarDetailsItemItemPage : MonoBehaviour
{
    public Text name;
    public Text id;
    public Text score;

    public void InitMsg(WarDetailsUserRet sacr)
    {
        name.text = sacr.UserName;
        id.text = "ID："+ sacr.UserID;
        score.text = sacr.TotalScore.ToString();

        #region
        //    //设置名字
        //    transform.FindChild("name").GetChild(i).gameObject.SetActive(true);
        //    transform.FindChild("name").GetChild(i).GetComponent<Text>().text = sacr.User[i].UserName;
        //    //将分数，牌型，手牌显示设为true
        //    transform.FindChild("card").GetChild(i).gameObject.SetActive(true);
        //    //设置分数
        //    if (sacr.User[i].TotalScore >= 0)
        //    {
        //        transform.FindChild("card").GetChild(i).FindChild("userTotalScore").GetComponent<Text>().text = "<color=red>+" + sacr.User[i].TotalScore + "</color>";
        //    }
        //    else if (sacr.User[i].TotalScore < 0)
        //    {
        //        transform.FindChild("card").GetChild(i).FindChild("userTotalScore").GetComponent<Text>().text = "<color=green>" + sacr.User[i].TotalScore + "</color>";
        //    }
        //    //设置牌型
        //    transform.FindChild("card").GetChild(i).FindChild("type").GetComponent<Image>().sprite =
        //        Resources.Load<Sprite>("Type/" + sacr.User[i].CardType);
        //    //设置手牌
        //    for (int j = 0; j < sacr.User[i].Cards.Length; j++)
        //    {
        //        Transform temp = transform.FindChild("card").GetChild(i).FindChild("cardGroup").GetChild(j);
        //        temp.gameObject.SetActive(true);

        //        if (sacr.User[i].Cards[j] <= 52)
        //        {
        //            temp.GetComponent<Image>().sprite = Resources.Load<Sprite>("Card/" + (sacr.User[i].Cards[j]).ToString());
        //        }
        //        else if (sacr.User[i].Cards[j] > 52)
        //        {
        //            temp.GetComponent<Image>().sprite = Resources.Load<Sprite>("Card/" + (sacr.User[i].Cards[j] % 52).ToString());
        //        }
        //    }
        //    //设置局数
        //    transform.Find("round/Text").GetComponent<Text>().text = currentChapter.ToString() + "/" + sacr.MaxChapter.ToString();
        //}
        #endregion
    }
}
